home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3x / cpusetGetName.z / cpusetGetName
Encoding:
Text File  |  2002-10-03  |  6.4 KB  |  133 lines

  1.  
  2.  
  3.  
  4. ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeee((((3333xxxx))))                                            ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeee((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cpusetGetName - get the name of the cpuset to which a process is attached
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ccccppppuuuusssseeeetttt....hhhh>>>>
  13.  
  14.      ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt ****ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeee((((ppppiiiidddd____tttt ppppiiiidddd))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The _c_p_u_s_e_t_G_e_t_N_a_m_e function is used to obtain the name of the cpuset to
  18.      which the specified process has been attached.  The ppppiiiidddd argument
  19.      specifies the process ID.  Currently, the only valid value for ppppiiiidddd is 0,
  20.      which returns the name of the cpuset to which the current process is
  21.      attached.
  22.  
  23.      The function returns a pointer to a structure of type ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt
  24.      (defined in <cpuset.h>).  The function _c_p_u_s_e_t_G_e_t_N_a_m_e allocates the memory
  25.      for the structure and all of its associated data.  The user is
  26.      responsible for freeing the memory using the function
  27.      _c_p_u_s_e_t_F_r_e_e_N_a_m_e_L_i_s_t(3x).  The ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt structure is defined as
  28.      follows:
  29.  
  30.                typedef struct {
  31.                    int    count;
  32.                    char   **list;
  33.                    int   *status;
  34.                } cpuset_NameList_t;
  35.  
  36.  
  37.      ccccoooouuuunnnntttt is the number of cpuset names in the list.  In the case of
  38.      _c_p_u_s_e_t_G_e_t_N_a_m_e this member will should only contain the values of 0 and 1.
  39.  
  40.      lllliiiisssstttt references the list of names.
  41.  
  42.      ssssttttaaaattttuuuussss is a list of status flags that indicate the status of the
  43.      corresponding cpuset name in lllliiiisssstttt.  The following flag values may be
  44.      used:
  45.  
  46.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______QQQQ_UUUU_EEEE_UUUU_EEEE______NNNN_AAAA_MMMM_EEEE
  47.             Indicates that the corresponding name in lllliiiisssstttt is the name of a
  48.             cpuset queue.
  49.  
  50.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______CCCC_PPPP_UUUU______NNNN_AAAA_MMMM_EEEE
  51.             Indicates that the corresponding name in lllliiiisssstttt is the CPU ID for a
  52.             restricted CPU.
  53.  
  54.      The memory for lllliiiisssstttt and ssssttttaaaattttuuuussss is allocated when the ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt is
  55.      allocated and it is released when the ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt structure is
  56.      released.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeee((((3333xxxx))))                                            ccccppppuuuusssseeeettttGGGGeeeettttNNNNaaaammmmeeee((((3333xxxx))))
  71.  
  72.  
  73.  
  74. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  75.      This example obtains cpuset name or CPU ID to which the current process
  76.      is attached:
  77.  
  78.                cpuset_NameList_t *name;
  79.  
  80.                /* Get the name else print error & exit */
  81.                if ( !(name = cpusetGetName(0)) ) {
  82.                    perror("cpusetGetName");
  83.                    exit(1);
  84.                }
  85.                if (name->count == 0) {
  86.                    printf("Current process not attached\n");
  87.                } else {
  88.                    if (name->status[0] == CPUSET_CPU_NAME) {
  89.                        printf("Current process attached to"
  90.                                " CPU_ID[%s]\n",
  91.                                name->list[0]);
  92.                    } else {
  93.                        printf("Current process attached to"
  94.                                " CPUSET[%s]\n",
  95.                                name->list[0]);
  96.                    }
  97.                }
  98.                cpusetFreeNameList(name);
  99.  
  100.  
  101. NNNNOOOOTTTTEEEESSSS
  102.      _c_p_u_s_e_t_G_e_t_N_a_m_e is found in the library "libcpuset.so", and will be loaded
  103.      if the option _----_llll_cccc_pppp_uuuu_ssss_eeee_tttt is used with _cccc_cccc(1) or _llll_dddd(1).
  104.  
  105. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  106.      cpuset(1), cpusetFreeNameList(3x), cpusetGetNameList(3x), cpuset(5).
  107.  
  108. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  109.      If successful, _c_p_u_s_e_t_G_e_t_N_a_m_e returns a pointer to a ccccppppuuuusssseeeetttt____NNNNaaaammmmeeeeLLLLiiiisssstttt____tttt
  110.      structure.  If _c_p_u_s_e_t_G_e_t_N_a_m_e fails, it returns NULL and eeeerrrrrrrrnnnnoooo is set to
  111.      indicate the error.  The possible values for eeeerrrrrrrrnnnnoooo include those values
  112.      as set by _s_y_s_m_p(2), _s_b_r_k(2), and the following:
  113.  
  114.      EEEEIIIINNNNVVVVAAAALLLL
  115.           Invalid value for _pppp_iiii_dddd was supplied.  Currenlty only 0 is accepted to
  116.           obtain the cpuset name that the current process is attached to.
  117.  
  118.      EEEERRRRAAAANNNNGGGGEEEE
  119.           Number of CPUs configured on the system is not a value greater than
  120.           or equal to 1.
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.